package com.gt.web.srv.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.HashMap;
import java.util.Map;

/**
 * 文章分类类型
 *
 * @author Yu Chaohua
 * @date 2024/5/24 0:46
 */
@Getter
@AllArgsConstructor
public enum ColumnTypeEnum {

    // 定义枚举常量
    RACING_TONG_LING(1, "党建统领", 0),
    THEORY_LEARNING(2, "理论学习", 0),
    THEME_ACTIVITY(3, "主题活动", 0),
    ACTIVITY_PARTICIPATION(4, "活动参与", 0),
    PARTICIPATE_IN_LEARNING(5, "参加学习", 1),
    SOCIAL_LAW_AND_ORDER(7, "社会治安", 0),
    PUBLIC_VIRTUE(8, "公益美德", 0),
    URBAN_RURAL_CONSTRUCTION(9, "城乡建设", 0),
    SAFETY_MANAGEMENT(10, "安全管理", 0),
    HONOR_REWARD(11, "荣誉奖励", 0);;

    private Integer code;

    private String desc;

    /**
     * 是否本村 0否 1是
     */
    private int isVillage;

    private static final Map<Integer, ColumnTypeEnum> CODE_MAP = new HashMap<>((int) (values().length / .75f) + 1);

    static {
        for (ColumnTypeEnum item : values()) {
            CODE_MAP.put(item.code, item);
        }
    }

    public static ColumnTypeEnum fromCode(Integer code) {
        return CODE_MAP.get(code);
    }
}
